<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>社交活动平台 - 好友关系</title>
    <style>
        /* 重置样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        /* 容器样式 */
        .container {
            max-width: 480px;
            margin: 0 auto;
            background-color: #fff;
            min-height: 100vh;
        }

        /* 头部导航 */
        .header {
            position: sticky;
            top: 0;
            background-color: white;
            padding: 16px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            z-index: 100;
        }

        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .back-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #333;
        }

        .header-title {
            font-size: 18px;
            font-weight: bold;
            flex-grow: 1;
            text-align: center;
        }

        .action-btn {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #333;
        }

        /* 搜索区域 */
        .search-section {
            padding: 16px;
            background-color: #f9f9f9;
            border-bottom: 1px solid #eee;
        }

        .search-container {
            display: flex;
            align-items: center;
            background-color: white;
            border-radius: 24px;
            padding: 8px 16px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .search-icon {
            color: #999;
            margin-right: 8px;
        }

        .search-input {
            flex-grow: 1;
            border: none;
            outline: none;
            font-size: 15px;
            background-color: transparent;
        }

        /* 好友列表头部 */
        .friends-header {
            padding: 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #eee;
        }

        .friends-title {
            font-size: 18px;
            font-weight: bold;
        }

        .friends-count {
            color: #666;
            font-size: 14px;
        }

        /* 好友列表 */
        .friends-list {
            padding: 16px;
        }

        /* 好友卡片 */
        .friend-card {
            display: flex;
            align-items: center;
            padding: 16px 0;
            border-bottom: 1px solid #eee;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .friend-card:hover {
            background-color: #f9f9f9;
        }

        .friend-avatar {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: #e0e0e0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            margin-right: 16px;
        }

        .friend-info {
            flex-grow: 1;
        }

        .friend-name {
            font-weight: bold;
            margin-bottom: 4px;
            color: #333;
        }

        .friend-status {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .status-indicator {
            width: 8px;
            height: 8px;
            border-radius: 50%;
        }

        .status-online {
            background-color: #4caf50;
        }

        .status-offline {
            background-color: #9e9e9e;
        }

        .friend-last-seen {
            font-size: 12px;
            color: #999;
        }

        .friend-actions {
            display: flex;
            gap: 12px;
        }

        .action-icon {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #f0f0f0;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .action-icon:hover {
            background-color: #e0e0e0;
            transform: scale(1.1);
        }

        /* 空状态 */
        .empty-state {
            text-align: center;
            padding: 60px 20px;
        }

        .empty-icon {
            font-size: 64px;
            margin-bottom: 20px;
            color: #ccc;
        }

        .empty-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 12px;
            color: #666;
        }

        .empty-description {
            color: #999;
            margin-bottom: 24px;
        }

        .empty-btn {
            background: linear-gradient(135deg, #45b7d1 0%, #2c8cb9 100%);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 24px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .empty-btn:hover {
            transform: scale(1.05);
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: white;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            z-index: 100;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #9e9e9e;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .nav-item.active {
            color: #ff6b35;
        }

        .nav-icon {
            font-size: 20px;
            margin-bottom: 4px;
        }

        /* 加载动画 */
        .loading {
            text-align: center;
            padding: 40px 20px;
        }

        .spinner {
            width: 36px;
            height: 36px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #ff6b35;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: white;
            border-radius: 16px;
            width: 85%;
            max-width: 320px;
            padding: 24px;
            text-align: center;
            transform: translateY(20px);
            opacity: 0;
            transition: all 0.3s ease;
        }

        .modal.show {
            transform: translateY(0);
            opacity: 1;
        }

        .modal-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 16px;
            color: #333;
        }

        .modal-message {
            margin-bottom: 24px;
            color: #666;
            line-height: 1.6;
        }

        .modal-actions {
            display: flex;
            gap: 12px;
        }

        .modal-btn {
            flex: 1;
            padding: 12px;
            border-radius: 8px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .cancel-btn {
            background-color: #f5f5f5;
            color: #666;
        }

        .confirm-btn {
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
        }

        /* 响应式适配 */
        @media (max-width: 480px) {
            .header-content {
                padding-top: 4px;
            }
            
            .friend-avatar {
                width: 45px;
                height: 45px;
                font-size: 20px;
            }
        }

        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .friend-card {
            animation: fadeInUp 0.6s ease forwards;
        }

        /* 按钮状态动画 */
        .action-icon {
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }

        /* 分组标题 */
        .section-title {
            padding: 16px;
            font-size: 14px;
            color: #999;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: 1px solid #eee;
        }

        /* 好友分组 */
        .friends-group {
            margin-bottom: 20px;
        }

        /* 好友状态标签 */
        .status-tag {
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 10px;
            font-weight: bold;
        }

        .tag-online {
            background-color: #e8f5e9;
            color: #388e3c;
        }

        .tag-offline {
            background-color: #f5f5f5;
            color: #9e9e9e;
        }

        .tag-active {
            background-color: #fff8e1;
            color: #ff8f00;
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 头部导航 -->
        <header class="header">
            <div class="header-content">
                <button class="back-btn" id="backBtn">←</button>
                <div class="header-title">好友关系</div>
                <button class="action-btn" id="addFriendBtn">+</button>
            </div>
        </header>

        <!-- 搜索区域 -->
        <div class="search-section">
            <div class="search-container">
                <span class="search-icon">🔍</span>
                <input type="text" class="search-input" placeholder="搜索好友..." id="searchInput">
            </div>
        </div>

        <!-- 好友列表头部 -->
        <div class="friends-header">
            <div class="friends-title">我的好友</div>
            <div class="friends-count">共24位好友</div>
        </div>

        <!-- 好友列表 -->
        <div class="friends-list" id="friendsList">
            <!-- 分组标题 -->
            <div class="section-title">在线好友</div>
            
            <!-- 在线好友卡片 -->
            <div class="friend-card" data-friend-id="1">
                <div class="friend-avatar">👤</div>
                <div class="friend-info">
                    <div class="friend-name">李小红</div>
                    <div class="friend-status">
                        <span class="status-indicator status-online"></span>
                        <span>在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="2">
                <div class="friend-avatar">👥</div>
                <div class="friend-info">
                    <div class="friend-name">王大力</div>
                    <div class="friend-status">
                        <span class="status-indicator status-online"></span>
                        <span>在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="3">
                <div class="friend-avatar">👨‍👩‍👧</div>
                <div class="friend-info">
                    <div class="friend-name">刘小美</div>
                    <div class="friend-status">
                        <span class="status-indicator status-online"></span>
                        <span>在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <!-- 分组标题 -->
            <div class="section-title">最近活跃</div>
            
            <!-- 最近活跃好友卡片 -->
            <div class="friend-card" data-friend-id="4">
                <div class="friend-avatar">🤖</div>
                <div class="friend-info">
                    <div class="friend-name">赵小花</div>
                    <div class="friend-status">
                        <span class="status-indicator status-online"></span>
                        <span>在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="5">
                <div class="friend-avatar">🌟</div>
                <div class="friend-info">
                    <div class="friend-name">钱大伟</div>
                    <div class="friend-status">
                        <span class="status-indicator status-online"></span>
                        <span>在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <!-- 分组标题 -->
            <div class="section-title">其他好友</div>
            
            <!-- 其他好友卡片 -->
            <div class="friend-card" data-friend-id="6">
                <div class="friend-avatar">🎉</div>
                <div class="friend-info">
                    <div class="friend-name">孙小丽</div>
                    <div class="friend-status">
                        <span class="status-indicator status-offline"></span>
                        <span>3小时前在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="7">
                <div class="friend-avatar">🚀</div>
                <div class="friend-info">
                    <div class="friend-name">周小明</div>
                    <div class="friend-status">
                        <span class="status-indicator status-offline"></span>
                        <span>昨天在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="8">
                <div class="friend-avatar">🎨</div>
                <div class="friend-info">
                    <div class="friend-name">吴小芳</div>
                    <div class="friend-status">
                        <span class="status-indicator status-offline"></span>
                        <span>2天前在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="9">
                <div class="friend-avatar">🎮</div>
                <div class="friend-info">
                    <div class="friend-name">郑小强</div>
                    <div class="friend-status">
                        <span class="status-indicator status-offline"></span>
                        <span>1周前在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="10">
                <div class="friend-avatar">📚</div>
                <div class="friend-info">
                    <div class="friend-name">陈小慧</div>
                    <div class="friend-status">
                        <span class="status-indicator status-offline"></span>
                        <span>1周前在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="11">
                <div class="friend-avatar">🎵</div>
                <div class="friend-info">
                    <div class="friend-name">林小杰</div>
                    <div class="friend-status">
                        <span class="status-indicator status-offline"></span>
                        <span>2周前在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="12">
                <div class="friend-avatar">🚴</div>
                <div class="friend-info">
                    <div class="friend-name">黄小军</div>
                    <div class="friend-status">
                        <span class="status-indicator status-offline"></span>
                        <span>3周前在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>

            <div class="friend-card" data-friend-id="13">
                <div class="friend-avatar">📸</div>
                <div class="friend-info">
                    <div class="friend-name">杨小丽</div>
                    <div class="friend-status">
                        <span class="status-indicator status-offline"></span>
                        <span>1个月前在线</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            </div>
        </div>

        <!-- 底部导航 -->
        <nav class="bottom-nav">
            <div class="nav-item" data-page="home">
                <span class="nav-icon">🏠</span>
                <span>首页</span>
            </div>
            <div class="nav-item" data-page="search">
                <span class="nav-icon">🔍</span>
                <span>搜索</span>
            </div>
            <div class="nav-item" data-page="publish">
                <span class="nav-icon">➕</span>
                <span>发布</span>
            </div>
            <div class="nav-item active" data-page="profile">
                <span class="nav-icon">👤</span>
                <span>我的</span>
            </div>
        </nav>

        <!-- 添加好友弹窗 -->
        <div class="modal" id="addFriendModal">
            <div class="modal-content">
                <h3 class="modal-title">添加好友</h3>
                <p class="modal-message">
                    通过手机号或用户名搜索添加好友<br>
                    或者扫描二维码邀请朋友加入
                </p>
                <div class="modal-actions">
                    <button class="modal-btn cancel-btn" id="cancelAddBtn">取消</button>
                    <button class="modal-btn confirm-btn" id="confirmAddBtn">搜索好友</button>
                </div>
            </div>
        </div>

        <!-- 加载状态 -->
        <div class="loading" id="loadingIndicator">
            <div class="spinner"></div>
            <p>加载中...</p>
        </div>

        <!-- 通知 Toast -->
        <div id="toast" style="display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #4caf50; color: white; padding: 12px 24px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1001;"></div>
    </div>

    <script>
        // 全局变量
        let currentFriendId = null;
        let friendsData = [
            { id: 1, name: "李小红", status: "online", lastSeen: "在线" },
            { id: 2, name: "王大力", status: "online", lastSeen: "在线" },
            { id: 3, name: "刘小美", status: "online", lastSeen: "在线" },
            { id: 4, name: "赵小花", status: "online", lastSeen: "在线" },
            { id: 5, name: "钱大伟", status: "online", lastSeen: "在线" },
            { id: 6, name: "孙小丽", status: "offline", lastSeen: "3小时前在线" },
            { id: 7, name: "周小明", status: "offline", lastSeen: "昨天在线" },
            { id: 8, name: "吴小芳", status: "offline", lastSeen: "2天前在线" },
            { id: 9, name: "郑小强", status: "offline", lastSeen: "1周前在线" },
            { id: 10, name: "陈小慧", status: "offline", lastSeen: "1周前在线" },
            { id: 11, name: "林小杰", status: "offline", lastSeen: "2周前在线" },
            { id: 12, name: "黄小军", status: "offline", lastSeen: "3周前在线" },
            { id: 13, name: "杨小丽", status: "offline", lastSeen: "1个月前在线" }
        ];

        // 初始化
        document.addEventListener('DOMContentLoaded', function() {
            initEventListeners();
            simulateLoading();
            
            // 模拟好友列表数据
            updateFriendsList(friendsData);
        });

        // 初始化事件监听器
        function initEventListeners() {
            // 返回按钮
            document.getElementById('backBtn').addEventListener('click', function() {
                window.history.back();
            });

            // 添加好友按钮
            document.getElementById('addFriendBtn').addEventListener('click', function() {
                const modal = document.getElementById('addFriendModal');
                modal.classList.add('show');
            });

            // 弹窗确认按钮
            document.getElementById('confirmAddBtn').addEventListener('click', function() {
                // 模拟搜索好友
                showSuccessToast('正在搜索好友...');
                
                setTimeout(() => {
                    closeAddFriendModal();
                    showSuccessToast('找到1位好友，已发送添加请求');
                }, 1500);
            });

            // 弹窗取消按钮
            document.getElementById('cancelAddBtn').addEventListener('click', closeAddFriendModal);

            // 弹窗背景点击关闭
            document.getElementById('addFriendModal').addEventListener('click', function(e) {
                if (e.target === this) {
                    closeAddFriendModal();
                }
            });

            // 底部导航切换
            const navItems = document.querySelectorAll('.nav-item');
            navItems.forEach(item => {
                item.addEventListener('click', function() {
                    // 移除所有激活状态
                    navItems.forEach(i => i.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                    
                    const page = this.dataset.page;
                    handleNavigation(page);
                });
            });

            // 搜索功能
            const searchInput = document.getElementById('searchInput');
            searchInput.addEventListener('input', function() {
                const searchTerm = this.value.toLowerCase();
                filterFriends(searchTerm);
            });

            // 好友卡片点击事件
            const friendCards = document.querySelectorAll('.friend-card');
            friendCards.forEach(card => {
                card.addEventListener('click', function() {
                    const friendId = this.dataset.friendId;
                    const friendName = this.querySelector('.friend-name').textContent;
                    
                    // 模拟跳转到好友详情页
                    alert(`查看好友：${friendName} 的详细信息`);
                });
            });

            // 好友操作按钮
            const actionIcons = document.querySelectorAll('.action-icon');
            actionIcons.forEach(icon => {
                icon.addEventListener('click', function(e) {
                    e.stopPropagation();
                    
                    const friendCard = this.closest('.friend-card');
                    const friendId = friendCard.dataset.friendId;
                    const friendName = friendCard.querySelector('.friend-name').textContent;
                    
                    const actionType = this.title;
                    
                    switch(actionType) {
                        case '私信':
                            alert(`开始与 ${friendName} 私信聊天`);
                            break;
                        case '查看活动':
                            alert(`查看 ${friendName} 的活动动态`);
                            break;
                    }
                });
            });

            // 模拟好友在线状态变化
            setInterval(() => {
                updateOnlineStatus();
            }, 30000); // 每30秒更新一次
        }

        // 关闭添加好友弹窗
        function closeAddFriendModal() {
            const modal = document.getElementById('addFriendModal');
            modal.classList.remove('show');
        }

        // 处理导航切换
        function handleNavigation(page) {
            switch(page) {
                case 'home':
                    alert('跳转到首页');
                    break;
                case 'search':
                    alert('跳转到搜索页面');
                    break;
                case 'publish':
                    alert('跳转到发布页面');
                    break;
                case 'profile':
                    // 个人中心无需特殊处理
                    break;
            }
        }

        // 显示加载状态
        function showLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'block';
        }

        // 隐藏加载状态
        function hideLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'none';
        }

        // 模拟加载效果
        function simulateLoading() {
            showLoading();
            setTimeout(() => {
                hideLoading();
            }, 1500);
        }

        // 显示成功提示
        function showSuccessToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.style.display = 'block';
            
            // 3秒后自动隐藏
            setTimeout(() => {
                toast.style.display = 'none';
            }, 3000);
        }

        // 更新好友列表
        function updateFriendsList(friends) {
            const friendsList = document.getElementById('friendsList');
            
            // 清空现有列表
            while (friendsList.firstChild) {
                if (!friendsList.firstChild.classList.contains('section-title')) {
                    friendsList.removeChild(friendsList.firstChild);
                }
            }
            
            // 重新添加好友卡片
            friends.forEach(friend => {
                const friendCard = createFriendCard(friend);
                friendsList.appendChild(friendCard);
            });
        }

        // 创建好友卡片
        function createFriendCard(friend) {
            const card = document.createElement('div');
            card.className = 'friend-card';
            card.dataset.friendId = friend.id;
            
            const statusClass = friend.status === 'online' ? 'status-online' : 'status-offline';
            const statusText = friend.status === 'online' ? '在线' : friend.lastSeen;
            
            card.innerHTML = `
                <div class="friend-avatar">${getFriendAvatar(friend.name)}</div>
                <div class="friend-info">
                    <div class="friend-name">${friend.name}</div>
                    <div class="friend-status">
                        <span class="status-indicator ${statusClass}"></span>
                        <span>${statusText}</span>
                    </div>
                </div>
                <div class="friend-actions">
                    <div class="action-icon" title="私信">💬</div>
                    <div class="action-icon" title="查看活动">📅</div>
                </div>
            `;
            
            return card;
        }

        // 获取好友头像
        function getFriendAvatar(name) {
            const avatarMap = {
                '李小红': '👤',
                '王大力': '👥', 
                '刘小美': '👨‍👩‍👧',
                '赵小花': '🤖',
                '钱大伟': '🌟',
                '孙小丽': '🎉',
                '周小明': '🚀',
                '吴小芳': '🎨',
                '郑小强': '🎮',
                '陈小慧': '📚',
                '林小杰': '🎵',
                '黄小军': '🚴',
                '杨小丽': '📸'
            };
            
            return avatarMap[name] || '👤';
        }

        // 过滤好友
        function filterFriends(searchTerm) {
            const friendCards = document.querySelectorAll('.friend-card');
            
            friendCards.forEach(card => {
                const friendName = card.querySelector('.friend-name').textContent.toLowerCase();
                
                if (searchTerm === '' || friendName.includes(searchTerm)) {
                    card.style.display = 'flex';
                } else {
                    card.style.display = 'none';
                }
            });
        }

        // 更新在线状态
        function updateOnlineStatus() {
            const friendCards = document.querySelectorAll('.friend-card');
            
            friendCards.forEach(card => {
                const statusIndicator = card.querySelector('.status-indicator');
                const lastSeenText = card.querySelector('.friend-last-seen');
                
                // 随机改变状态（模拟）
                const isOnline = Math.random() > 0.3;
                
                if (isOnline) {
                    statusIndicator.className = 'status-indicator status-online';
                    lastSeenText.textContent = '在线';
                } else {
                    const hoursAgo = Math.floor(Math.random() * 24) + 1;
                    statusIndicator.className = 'status-indicator status-offline';
                    lastSeenText.textContent = `${hoursAgo}小时前在线`;
                }
            });
        }

        // 添加触摸反馈效果
        const buttons = document.querySelectorAll('button, .action-icon');
        buttons.forEach(button => {
            button.addEventListener('touchstart', function() {
                this.style.transform = 'scale(0.95)';
            });
            
            button.addEventListener('touchend', function() {
                this.style.transform = 'scale(1)';
            });
        });

        // 添加页面滚动效果
        let lastScrollTop = 0;
        window.addEventListener('scroll', function() {
            const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
            
            // 隐藏/显示底部导航
            const bottomNav = document.querySelector('.bottom-nav');
            if (scrollTop > lastScrollTop && scrollTop > 100) {
                bottomNav.style.transform = 'translateY(100%)';
            } else {
                bottomNav.style.transform = 'translateY(0)';
            }
            
            lastScrollTop = scrollTop;
        });

        // 添加返回顶部功能
        window.addEventListener('scroll', function() {
            if (window.pageYOffset > 300) {
                // 可以添加返回顶部按钮
            }
        });
    </script>
</body>
</html>
